package fristphase.day9_14;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ArrayToListDemo {
    public static void main(String[] args) {
        String[] array = {"one","two","three","four","five"};
        System.out.println("array:"+ Arrays.toString(array));//1

        List<String> list = Arrays.asList(array);
        System.out.println("list"+list);//2

        array[1] = "six";
        list.set(3,"牛");//验证新List对象会影响原数组对
        System.out.println("array"+Arrays.toString(array));//3
        System.out.println("list"+list);//4

        List<String> list2 = new ArrayList<>(list);
        System.out.println("list2:"+list2);//5
        list2.add("!!!!!");
        System.out.println("list2:"+list2);//6
    }
}
